# -*- encoding: utf-8 -*-

def check(fn):
    def inner():
        print('请先登录，并发表言论')
        fn()
        print("言论讲述完毕")
    return inner


"""
这下面两个相等
@check
comment = check(comment)
"""


@check
def comment():
    print("发表评论")


# @check
def shopping():
    print("买买买")

# comment = check(comment)
# ①调用comment方法，返回inner。fn是comment
# comment = inner


shop = check(shopping)
comment()
shop()
# ②调用inner()，执行方法
"""
    def inner():
        print('请先登录，并发表言论')
        fn()
        print("言论讲述完毕")
"""
# ③执行fn()
"""
# fn == comment。
# fn() = comment()
# 执行 comment()
def comment():
    print("发表评论")
"""
